#include <stdio.h>
#include <string.h>

#define NUM_ROWS 3
#define NUM_COLS 15


/**
 * 二维字符数组
 */
int main() {

	char aa[2][90], bb[NUM_ROWS][NUM_COLS];
	int i, occupied, reserved;
	FILE *output_stream = fopen("C7_3.OUT", "w");

	printf("******* Section 1 - Initialising *********\n");
	strcpy(aa[0], "The aa[][] array ");
	strcpy(aa[1], "has 2 strings.\n");
	strcpy(bb[0], "The bb array ");
	strcpy(bb[1], "has ");
	strcpy(bb[2], "3 strings.");

	printf("******* Section 2 - Printing *********\n");
	for (i = 0; i < 2; i++) {
		printf("%s", aa[i]);
	}
	for (i = 0; i < NUM_ROWS; i++) {
		printf("%s", bb[i]);
	}
	for (i = 0; i < NUM_ROWS; i++) {
		fputs(bb[i], output_stream);
	}

	reserved = sizeof bb[0];
	occupied = strlen(bb[0]);
	printf("Reserved bytes for bb[0] = %d \n"
		   "Occupied bytes for bb[0] = %d\n", reserved, occupied);
}